package com.personal.system.mapper.seckill;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.personal.system.entity.seckill.SeckillOrder;
import com.personal.system.entity.seckill.SeckillOrderVo;
import org.apache.ibatis.annotations.Select;

public interface SeckillOrderMapper extends BaseMapper<SeckillOrder> {

    @Select("select\n" +
            "so.order_id,\n" +
            "so.goods_id,\n" +
            "oi.goods_price msPrice,\n" +
            "gs.goods_price goodsPrice,\n" +
            "gs.goods_title,\n" +
            "gs.goods_detail,\n" +
            "oi.create_date \n" +
            "from\n" +
            "seckill_order so\n" +
            "left join order_info oi on so.order_id = oi.id\n" +
            "left join goods gs on so.goods_id = gs.id " +
            "where so.user_id = #{userId} order by oi.create_date desc")
    IPage<SeckillOrderVo> detail(Page<SeckillOrderVo> pageParam, Long userId);

}
